<%@ page pageEncoding="utf-8"%>
<%request.setCharacterEncoding("utf-8");%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@ page import="com.ecomm.chat.manager.*"%>
<%@ page import="com.ecomm.chat.pojo.*"%>
<%@include file="/include/pageexpires.jsp"%>
<%@include file="/include/filepath.jsp"%>
<%@include file="/include/currentuserinfo.jsp"%>

<% 
String groupid = (String)request.getParameter("groupid") != null ?(String)request.getParameter("groupid"):"";
String nick = (String)request.getParameter("nick") != null ?(String)request.getParameter("nick"):"";
String id = (String)request.getParameter("id") != null ?(String)request.getParameter("id"):"";
String bigtype = (String)request.getParameter("bigtype") != null ?(String)request.getParameter("bigtype"):"";
String parentid = (String)request.getParameter("parentid") != null ?(String)request.getParameter("parentid"):"";
String type = (String)request.getParameter("type") != null ?(String)request.getParameter("type"):"";
//String chatid = (String)request.getParameter("chatid") != null ?(String)request.getParameter("chatid"):"";
ChatUserInfoManager cuim =   ChatUserInfoManager.getInstance();
//new add by ppliang 5.18
%>
<HTML>
  <HEAD>
    <META http-equiv=Content-Type content="text/html; charset=utf-8">
    <META content="MSHTML 6.00.2800.1561" name=GENERATOR>
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <link type="text/css" rel="stylesheet" href="<%=ctxpath%>/themes/newstyle/styles/office97/office97menu.css" id="menuStyleSheet">
  </HEAD>
  <script language="javascript">

function selectappenduser(userid,chatListenid) {
    var src = "<%=ctxpath%>/orgmodel/selectappenduser.jsp?userid="+userid+"&chatListenid="+chatListenid;
    window.open(src, "_blank", "height=500, width=300, top=0, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
}
  </script>
  <BODY id="chatrightbody">
    <!--the mouse over and dragging class are defined on each item-->
    <%
    if((groupid != null && !groupid.equals("")) || (bigtype != null && bigtype.equals("2") && (type != null && type.equals("2")))){
  ChatGroup chatGroup =  ChatGroupManager.getInstance().getChatGroup(groupid);
    
    %>
    <table class="chat_right_table" border="0" cellpadding="0" cellspacing="0"> 
      <tr>
        <td valign="top" class="chat_right_toptd" height="35%" >
          <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> 
            <tr>
              <td valign="top" class="chat_right_titletd">群名称：<%=chatGroup.getGroupname()%></td>
            </tr>
            <tr>
              <td valign="top" class="chat_right_contenttd">
                <div class="chat_right_contentdiv">
                  创建人：<%=com.ecomm.util.CommonMethod.getUserNameByUserID(chatGroup.getCerateuserid())%><br>
                  群描述：<br>
                  <%=chatGroup.getGroupdesc()%><br>              
                </div>
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td valign="top" class="chat_right_bottomtd" height="65%" >
          <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> 
            <tr>
              <td valign="top" class="chat_right_titletd">群内人员</td>
            </tr>
            <tr>
              <td valign="top" class="chat_right_contenttd"><div class="chat_right_contentdiv"><%
                  String[] members = chatGroup.getGroupmember().split(",");
                  if(members != null){
                    for(int i = 0;i<members.length;i++){
                      ChatUserInfo cui = (ChatUserInfo)cuim.getChatUserInfoByUserid(members[i]);
                      if(cui != null){
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/<%=cui.getImgPath()%>_<%=cui.getOnlinestate()%>.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(members[i])%>：<%=com.ecomm.util.StringUtils.noNullStr(cui.getChatdesc())%><br>
                  <%
                      }else{
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/1_0.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(members[i])%><br>
                  <%
                      }
                    }
                  }
                  %>            
                </div>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <%
    }else{
    %>
    <table border="0" cellpadding="0" cellspacing="0" class="chat_right_table" valign="top"> 
      <tr>
        <td valign="top" class="chat_right_toptd" height="60%">
          <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="chat_right_titletd">接收人</td>
            </tr>
            <tr>
              <td valign="top" class="chat_right_contenttd"><div class="chat_right_contentdiv"><%
                  //和谁聊天，并且对方的个性签名
              
              ChatUserInfo cui = (ChatUserInfo)cuim.getChatUserInfoByUserid(id);
              if(cui != null){
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/<%=cui.getImgPath()%>_<%=cui.getOnlinestate()%>.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(id)%>：<%=com.ecomm.util.StringUtils.noNullStr(cui.getChatdesc())%><br>
                  <%}else{
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/1_0.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(id)%><br>
                  <%
                  }
              ChatListenManager clm = ChatListenManager.getInstance();
              String chatListenid = clm.chatListen(id,nick);
              ChatListen chatl = clm.getChatliseten(chatListenid);
              String userids = id+","+nick;
              if(chatl.getJoinpeoplename()!= null && !chatl.getJoinpeoplename().equals("")){
                userids += ","+chatl.getJoinpeoplename();
                String[] useridChatl = chatl.getJoinpeoplename().split(",");
                if(useridChatl != null){
                  for(int k =0;k <useridChatl.length;k++){
                    ChatUserInfo cui_lis = (ChatUserInfo)cuim.getChatUserInfoByUserid(useridChatl[k]);
                    if(cui_lis != null){
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/<%=cui_lis.getImgPath()%>_<%=cui_lis.getOnlinestate()%>.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(useridChatl[k])%>：<%=com.ecomm.util.StringUtils.noNullStr(cui_lis.getChatdesc())%><br>
                  <%
                    }else{
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/1_0.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(useridChatl[k])%><br>
                  <%
                    }
                  }
                }
              }
                  %>
                </div>
              </td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td class="chat_right_chooicetd" height="10%">
          <input type="button"  onclick="selectappenduser('<%=userids%>','<%=chatListenid%>')" name="chooice" value="追加接收人" class="button" >
        </td>
      </tr>
      <tr>
        <td valign="top"  class="chat_right_bottomtd" height="30%">
          <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="chat_right_titletd">发送人</td>
            </tr>
            <tr>
              <td valign="middle" align="center" class="chat_right_contenttd"><%
                  //和谁聊天，并且对方的个性签名
              ChatUserInfo cui_zj = (ChatUserInfo)cuim.getChatUserInfoByUserid(nick);
              if(cui_zj != null){
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/<%=cui_zj.getImgPath()%>_<%=cui_zj.getOnlinestate()%>.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(nick)%>：<%=com.ecomm.util.StringUtils.noNullStr(cui_zj.getChatdesc())%><br>
                  <%}else{
                  %>
                  <img src="<%=ctxpath%>/chat/img/online/1_0.gif" align="absmiddle" ><%=com.ecomm.util.CommonMethod.getUserNameByUserID(nick)%><br>
                  <%
                  } %>
                
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <%
    }
    %> 
  </BODY>
</HTML>





